<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set value="${pageContext.request.contextPath}" var="path" scope="page" />
<!--用户管理-->
<div class="main_tag">系统管理>用户管理</div>
<div class="sysm1_udiv">
	<table class="sysm1_utable" id="user_table">
		<tr>
			<th width="200">用户名</th>
			<th width="200">邮箱</th>
			<th width="200">手机</th>
			<th width="120">是否已验证</th>
			<th width="120">是否被禁用</th>
			<th>管理</th>
		</tr>
		<!--读取循环-->
		<c:forEach var="user" items="${page.list}">
			<tr>
			<td id="user_name">${user.username}</td>
			<td>${user.email}</td>
			<td>${user.mobile}</td>
			<td>${user.validation==true?"<i class='icon-ok-circle color_green'></i>":"<i class='icon-remove-circle color_red'></i>"}</td>
			<td>${user.forbid==true?"<i class='icon-ok-sign color_green'></i>":"<i class='icon-remove-sign color_red'></i>"}</td>
			<td><i class="icon-lock" id="user_lock"></i>
			<i id="user_unlock" class="icon-unlock-alt" style="margin-left:20px;"></i></td>
		</tr>
		</c:forEach>
	</table>
	<!--分页-->
	<jsp:include page="pager.jsp"></jsp:include>
</div>
<Script>
	$("#user_table").find("i#user_lock").click(function(){
		var username = $(this).parent().parent().find("td#user_name").html();
		$.post("${path}/CheckUserContorller",{
			username:username,
			forbid:false
		},function(data){
			alert(data);
			$("#load").load("${path}/ShowUserController",{x: 0});
		})
	});
	
	$("#user_table").find("i#user_unlock").click(function(){
		var username = $(this).parent().parent().find("td#user_name").html();
		$.post("${path}/CheckUserContorller",{
			username:username,
			forbid:true
		},function(data){
			alert(data);
			$("#load").load("${path}/ShowUserController",{x: 0});
		})
	});
	
	$(document).ready(function() {
		$("table tr").mouseover(function() {
			$(this).css("background", "#F3F3F3");
		});
		$("table tr").mouseout(function() {
			$(this).css("background", "");
		});
	});
</Script>